//**** Defines used to model the castling Moves. **** (define "KingInTheInitialPlace" ("IsPieceAt" "King" Mover (mapEntry "King" (mover))) ) (define "HasNeverMoved" (= (state at:(mapEntry #1 (mover))) 1) ) (define "PieceHasMoved" (set State at:(last To) 0) ) (define "RememberPieceHasMoved" (then (if (= (state at:(last To)) 1) "PieceHasMoved" ) ) ) (define "DoCastle" (move Slide (from (mapEntry #1 (mover))) #2 (between (exact #3) if:#4 ) #5 ) ) (define "SmallCastling" ("DoCastle" "King" E 2 (is Empty (to)) (then (and ("PieceHasMoved") ("DoCastle" "RookRight" W 2 True)))) ) (define "BigCastling" ("DoCastle" "King" W 2 (is Empty (to)) (then (and ("PieceHasMoved") ("DoCastle" "RookLeft" E 3 True)))) ) (define "Castling" (if (and { "KingInTheInitialPlace" ("HasNeverMoved" "King") }) (or (if (and ("HasNeverMoved" "RookLeft") (can Move ("DoCastle" "RookLeft" E 3 (is Empty (to)))) ) "BigCastling" ) (if (and ("HasNeverMoved" "RookRight") (can Move ("DoCastle" "RookRight" W 2 (is Empty (to)))) ) "SmallCastling" ) ) ) ) //**** Defines used to model the extra Pawn moves. **** (define "SetEnPassantLocation" (then (set Pending (ahead (last To) Backward)) ) ) (define "InLocationEnPassant" (and (is Pending) (= (to) (value Pending)) ) ) (define "EnPassant" (move Step (directions {FR FL}) (to if:"InLocationEnPassant") (then (remove (ahead (last To) Backward) ) ) ) ) (define "InitialPawnMove" (if (is In (from) (sites Start (piece (what at:(from))))) ("DoubleStepForwardToEmpty" "SetEnPassantLocation") ) ) //------------------------------------------------------------------------------ (game "Skirmish (GDL)" ("TwoPlayersNorthSouth") (equipment { (board (square 8)) ("ChessPawn" "Pawn" (or "InitialPawnMove" "EnPassant" ) (then ("ReplayInMovingOn" (sites Mover "Promotion"))) ) ("ChessRook" "Rook" ~ ("RememberPieceHasMoved")) ("ChessKing" "King" ~ ("RememberPieceHasMoved")) ("ChessBishop" "Bishop") ("ChessKnight" "Knight") ("ChessQueen" "Queen") (map "King" {(pair 1 "E1") (pair 2 "E8")}) (map "RookLeft" {(pair 1 "A1") (pair 2 "A8")}) (map "RookRight" {(pair 1 "H1") (pair 2 "H8")}) (regions "Promotion" P1 (sites Top)) (regions "Promotion" P2 (sites Bottom)) }) (rules (start { (place "Pawn1" (sites Row 1)) (place "Pawn2" (sites Row 6)) (place "Rook1" {"A1" "H1"} state:1) (place "Knight1" {"B1" "G1"}) (place "Bishop1" {"C1" "F1"}) (place "Queen1" coord:"D1") (place "King1" coord:"E1" state:1) (place "Rook2" {"A8" "H8"} state:1) (place "Knight2" {"B8" "G8"}) (place "Bishop2" {"C8" "F8"}) (place "Queen2" coord:"D8") (place "King2" coord:"E8" state:1) }) (play (if "SameTurn" (move Promote (last To) (piece {"Queen" "Knight" "Bishop" "Rook"}) Mover) (or (forEach Piece) ("Castling") ) ) ) (end (if (or (no Moves Next) (= (count Moves) 100)) (byScore { (score P1 (count Pieces P1)) (score P2 (count Pieces P2)) }) ) ) ) ) //------------------------------------------------------------------------------ (metadata (info { (description "Skirmish, a Chess variant by Alex Landau, has the same rules as Chess, but without checkmate and with a 100 turn limit.") (rules "The rules are the same as in Chess, without checkmate. The game is won either after 100 turns or when one player can no longer move, by the player with the most pieces.") (source "GDL version") (id "47") (version "1.3.12") (classification "board/war/replacement/eliminate/all") (author "Alex Landau") (credit "Eric Piette") (date "2005") } ) (graphics { (piece Scale "Pawn" 0.825) (piece Families {"Defined" "Microsoft" "Pragmata" "Symbola"}) (board Style Chess) }) (ai "Skirmish (GDL)_ai" ) )